const fs = require("fs");
const path = require("path");

var stdin = process.stdin;
var index = 0;
console.log("请输入要创建的文件夹：");
stdin.on("data", function(chunk){
    if(index==0){
        var str = chunk.toString("utf-8");
        var filePath = path.join(__dirname, "/"+str.slice(6));
        fs.mkdirSync(filePath);
        index++;
        console.log("请输入要创建的文件：");
    }else if(index==1){
        var str = chunk.toString("utf-8");
        var filePath = path.join(__dirname, "/"+str.slice(6));
        fs.writeFileSync(filePath, "hello world");
        index++;
        console.log("请输入要删除的文件：");
    }else{
        var str = chunk.toString("utf-8");
        var filePath = path.join(__dirname, "/"+str.slice(7));
        fs.unlinkSync(filePath);
        process.exit();
    }
})
